<div data-ng-controller="contractBalanceCtrl">
    <div class="table-header clearfix ng-scope">
        <span class="fl lh30 f14">{{contractBaseInfo.contract_code}}</span>
    </div>
    <form name="balanceEditForm" class="form-horizontal" novalidate>
        <div class="form-group mt10">
            <span class="col-sm-3 control-label">合同产品标准金额</span>

            <div class="col-sm-5">
                <input type="text" ng-model="balanceInfo.application_amount" class="form-control align-r"
                       id="inputPassword3"
                       ng-disabled="true"
                       placeholder="合同产品标准金额">
            </div>
            <span class="col-sm-3 control-label">合同产品成交总额</span>

            <div class="col-sm-5">
                <input type="text" ng-model="balanceInfo.rent_amount" class="form-control align-r" id="inputPassword3"
                       ng-disabled="true"
                       placeholder="合同产品成交总额">
            </div>
            <span class="col-sm-3 control-label">产品成交折扣(%)</span>

            <div class="col-sm-5">
                <input type="text" value="{{balanceInfo.application_deal_discount*100|number:2}}" class="form-control align-r"
                       id="inputPassword3"
                       ng-disabled="true"
                       placeholder="产品成交折扣">
            </div>
        </div>

        <div class="form-group mt10">
            <span class="col-sm-3 control-label">结算类型</span>

            <div class="col-sm-5">
                <input select2 ng-model="balanceInfo.balance_type" select2-model="ddl2BalanceType"
                       config="ddlConfigBalanceType" class="form-control" type="text"
                        required name="balance_type"/>
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.balance_type.$touched) && balanceEditForm.balance_type.$error.required"
                      class="error ng-hide c-red lh30">结算类型不能为空</span>
            </div>
            <span class="col-sm-3 control-label">结算比例(%)</span>

            <div class="col-sm-5">
                <input type="number" ng-model="balanceInfo.balance_rate" class="form-control align-r" id="inputPassword3"
                       placeholder="结算比例"
                       required min="0" max="100" number name="balance_rate">
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.balance_rate.$touched) && balanceEditForm.balance_rate.$error.required"
                      class="error ng-hide c-red lh30">结算比例不能为空</span>
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.balance_rate.$touched) && balanceEditForm.balance_rate.$error.number"
                      class="error ng-hide c-red lh30">结算比例必须是数值类型</span>
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.balance_rate.$touched) && (balanceEditForm.balance_rate.$error.min || balanceEditForm.balance_rate.$error.max)"
                      class="error ng-hide c-red lh30">结算比例必须介于0到100之间</span>
            </div>
            <span class="col-sm-3 control-label">结算金额</span>

            <div class="col-sm-5">
                <input type="number" ng-model="balanceInfo.balance_amount" class="form-control align-r"
                       id="inputPassword3" placeholder="结算金额"
                       required min="0" number name="balance_amount">
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.balance_amount.$touched) && balanceEditForm.balance_amount.$error.required"
                      class="error ng-hide c-red lh30">结算金额不能为空</span>
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.balance_amount.$touched) && balanceEditForm.balance_amount.$error.number"
                      class="error ng-hide c-red lh30">结算金额必须是数值类型</span>
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.balance_amount.$touched) && (balanceEditForm.balance_amount.$error.min)"
                      class="error ng-hide c-red lh30">结算金额必须大于等于0</span>
            </div>
        </div>
        <div class="form-group mt10">
            <span class="col-sm-3 control-label">返款金额</span>

            <div class="col-sm-5">
                <input type="number" ng-model="balanceInfo.back_amount" class="form-control align-r" id="inputPassword3"
                       placeholder="返款金额"
                       required min="0" number name="back_amount">
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.back_amount.$touched) && balanceEditForm.back_amount.$error.required"
                      class="error ng-hide c-red lh30">返款金额不能为空</span>
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.back_amount.$touched) && balanceEditForm.back_amount.$error.number"
                      class="error ng-hide c-red lh30">返款金额必须是数值类型</span>
                <span role="alert"
                      ng-show="(balanceEditForm.$submitted || balanceEditForm.back_amount.$touched) && (balanceEditForm.back_amount.$error.min)"
                      class="error ng-hide c-red lh30">返款金额必须大于等于0</span>
            </div>
        </div>
        <div class="form-group mt10">
            <span class="col-sm-3 control-label">备注</span>

            <div class="col-sm-21">
                <textarea type="text" ng-model="balanceInfo.balance_remark" class="form-control" id="inputPassword3"
                          placeholder="备注" rows="4"></textarea>
            </div>
        </div>
        <div class="form-group" ng-if="contractBaseInfo.contract_status == 0 && contractBaseInfo.is_cancelled == 0">
            <div class="ml35 mt15">
                <button type="submit" ng-click="balanceEditForm.$valid && save()" class="btn btn-default">保存</button>
            </div>
        </div>
    </form>
</div>